<?php
class sub extends baseController {    
	public function __construct() {
		parent::__construct ();
	}
    
    public function loadView($temp) {
        if (!isset($temp["data"]))
            $temp["data"] = '';
        $this->load->view("template", $temp);
    }
    
    public function index($slug) {
        $this->session->set_userdata('selectedMenu', 'services');
        $sub = $this->servicesModel->read(array('slug' => $slug, 'languageCode' => $this->session->userdata('languageCode')));
        if(!$sub) {
            redirect(base_url());
            return;   
        }
        $this->session->set_userdata('servicesDisplay', $sub['parentId']);
        $this->session->set_userdata('subDisplay', $sub['id']);
        $this->_data["template"] = 'sub';
        $this->_data["data"] = $sub;

        $this->loadView($this->_data);
    }
}
?>